home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DIRS.SWG / 0020_Another Change File Attr.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  1KB  |  32 lines

  1. { Updated FILES.SWG on November 2, 1993 }
  2.  
  3. {
  4. ts@uwasa.fi (Timo Salmi)
  5.  
  6.  Q: How can one hide (or unhide) a directory using a TP Program?
  7.  
  8.  A: SetFAttr which first comes to mind cannot be used For this.
  9. Instead interrupt Programming is required.  Here is the code.
  10. Incidentally, since MsDos 5.0 the attrib command can be used to hide
  11. and unhide directories.
  12. (* Hide a directory. Before using it would be prudent to check
  13.    that the directory exists, and that it is a directory.
  14.    With a contribution from Jan Nielsen jak@hdc.hha.dk
  15.    Based on information from Duncan (1986), p. 410 *)
  16. }
  17. Procedure HIDE(dirname : String);
  18. Var
  19.   regs : Registers;
  20. begin
  21.   FillChar(regs, SizeOf(regs), 0);    { standard precaution }
  22.   dirname := dirname + #0;           { requires ASCII Strings }
  23.   regs.ah := $43;                    { Function }
  24.   regs.al := $01;                    { subFunction }
  25.   regs.ds := Seg(dirname[1]);        { point to the name }
  26.   regs.dx := Ofs(dirname[1]);
  27.   regs.cx := 2; { set bit 1 on }     { to unhide set regs.cx := 0 }
  28.   Intr ($21, regs);                  { call the interrupt }
  29.   if regs.Flags and FCarry <> 0 then { were we successful }
  30.     Writeln('Failed to hide');
  31. end;
  32.